package com.smedi.ismedi.inmail.core.domain.service.impl;

import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.smedi.ismedi.authority.starter.util.AuthorityUtil;
import com.smedi.ismedi.inmail.core.application.query.vo.AnnouncementManagementQueryVo;
import com.smedi.ismedi.inmail.core.domain.aggregatemodel.announcement.Announcement;
import com.smedi.ismedi.inmail.core.domain.aggregatemodel.announcement.QueriedCriteria;
import com.smedi.ismedi.inmail.core.domain.dto.AnnouncementQuery;
import com.smedi.ismedi.inmail.core.domain.repository.*;
import com.smedi.ismedi.inmail.core.domain.service.AnnouncementDomainService;
import com.smedi.ismedi.inmail.core.infrastructure.convert.IfrConverter;
import com.smedi.ismedi.web.starter.util.DozerUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 业务服务实现类
 *
 * @author jiangqinxuan   niuyanling
 * @date 2021/07/27
 */
@Slf4j
@Service
@AllArgsConstructor
public class AnnouncementDomainServiceImpl implements AnnouncementDomainService {
    private final AnnouncementRepository announcementRepository;

    private final DozerUtil dozerUtil;

    private final AuthorityUtil authorityUtil;

    private final IfrConverter ifrConverter;

    @Override
    public Announcement saveAnnouncement(Announcement announcement) {
        return announcementRepository.doSave(announcement);
    }

    @Override
    public Announcement getAnnouncementOne(AnnouncementQuery announcementQuery) {
        return announcementRepository.getAnnouncementOne(announcementQuery);
    }

    @Override
    public void removeAnnouncement(AnnouncementQuery announcementQuery) {
        announcementRepository.deleteAnnouncement(announcementQuery);
    }

    @Override
    public Page<AnnouncementManagementQueryVo> queryAnnouncementByOrganizationManager(Boolean criteria, QueriedCriteria queriedCriteria) {
        return null;
    }

    @Override
    public Page<AnnouncementManagementQueryVo> queryAnnouncementByProjectManager(Boolean criteria, List<String> projectNameList, QueriedCriteria queriedCriteria) {
        return null;
    }

    @Override
    public Page<Announcement> queryAnnouncementByNormalUser(Boolean criteria, QueriedCriteria queriedCriteria) {
        return null;
    }

    /**
     * 判断附件信息是否完整。
     *
     * @param announcement 通知公告
     */
    private void isAttachmentInfoComplete(Announcement announcement) {
    }

    /**
     * 加载附件信息
     *
     * @param announcementManagementQueryVo 管理查询结果
     * @param announcementId                通知公告id
     * @return AnnouncementManagementQueryVo
     */
    private AnnouncementManagementQueryVo getAttachmentDetail(AnnouncementManagementQueryVo announcementManagementQueryVo, Long announcementId) {
        return null;
    }

    /**
     * 加载附件信息
     *
     * @param announcement   管理查询结果
     * @param announcementId 通知公告id
     * @return Announcement
     */
    private Announcement getAttachmentDetail(Announcement announcement, Long announcementId) {
        return null;
    }
}
